<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="shortcut icon" href="favicon.ico"> <link href="./src/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
        <link href="./src/css/font-awesome.css?v=4.4.0" rel="stylesheet">
        <link href="./src/css/plugins/iCheck/custom.css" rel="stylesheet">
        <link href="./src/css/animate.css" rel="stylesheet">
        <link href="./src/css/style.css?v=4.1.0" rel="stylesheet">
        <link href="./src/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
        <script type="text/javascript" src="src/js/jquery.min.js"></script>
        <script src="./src/js/jquery.min.js?v=2.1.4"></script>
        <script src="./src/js/bootstrap.min.js?v=3.3.6"></script>
        <script src="./src/js/content.js?v=1.0.0"></script>
        <script src="./src/js/plugins/sweetalert/sweetalert.min.js"></script>
        <script src="./src/js/My97DatePicker/WdatePicker.js"></script>
        <script>
            $(function() {
                $('.tbody').click(function() {

                    $('.tbody').removeClass('main_in_tr_content_cur');
                    $(this).addClass('main_in_tr_content_cur');
                });

                $('#new_order').click(function() {
                    location.href = './?m=order&a=detail';
                });

                $(".tbody").dblclick(function() {
                    var id = $(this).find('td').eq(3).html();
                    location.href = './?m=order&a=update&orderid_detail=' + id;
                });
                $("#zuofei").click(function() {         //作废
                    var ids = new Array();
                    $(".order_id:checked").each(function(i) {
                        ids[i] = $(this).val();
                    });
                    $.get("./?m=order&a=zufei&id=" + ids, function(data) {
                        if (data == 'sucess') {
                            swal({
                                title: "作废成功"
                            }, function() {
                                location.href = "./?m=order&a=list";
                            });
                        }
                    });
                });
                $("#fzuofei").click(function() { //反作废

                    var ids = new Array();
                    $(".order_id:checked").each(function(i) {
                        ids[i] = $(this).val();
                    });
                    $.get("./?m=order&a=fzufei&id=" + ids, function(data) {
                        if (data == 'sucess') {
                            swal({
                                title: "反作废成功"
                            }, function() {
                                location.href = "./?m=order&a=list";
                            });
                        }
                    });
                });
                $("#delete").click(function() {
                    var ids = new Array();
                    $(".order_id:checked").each(function(i) {
                        ids[i] = $(this).val();
                    });
                    $.get("./?m=order&a=delete&id=" + ids, function(data) {
                        if (data == 'sucess') {
                            swal({
                                title: "删除成功"
                            }, function() {
                                location.href = "./?m=order&a=list";
                            });
                        }
                    });
                });
                $("#hx").click(function() {
                    window.open("http://www.sipg.com.cn/containerQuery/index#", 'newwindow', 'height=800,width=1000,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
                });
                $("#release").click(function() {
                    window.open("http://www.haiguan.info/OnLineSearch/Gateway/Gatewaystate.aspx", 'dzhgfx', 'height=800,width=1000,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
                });
                $("#tosubmit").click(function() {
                    var ids = new Array();
                    $(".order_id:checked").each(function(i) {
                        ids[i] = $(this).val();
                    });
                    $.get("./?m=order&a=tosubmit&id=" + ids, function(data) {
                        if (data == 'sucess') {
                            swal({
                                title: "提交成功"
                            }, function() {
                                location.href = "./?m=order&a=list";
                            });
                        }
                    });
                });
                $("#cyprint").click(function() {
                    var ids = new Array();
                    $(".order_id:checked").each(function(i) {
                        ids[i] = $(this).val();
                    });
                    if (ids.length) {
                        window.open("./?m=order&a=cyprint&id=" + ids);
                    }
                });
                $("#daocyd").click(function(){
                        var ids = new Array();
                    $(".order_id:checked").each(function(i) {
                        ids[i] = $(this).val();
                    });
                    if (ids.length) {
                        window.open("./?m=order&a=cyprint&type=2&id=" + ids);
                    }
                });
                $("#vipprint").click(function() {
                    var ids = new Array();
                    $(".order_id:checked").each(function(i) {
                        ids[i] = $(this).val();
                    });
                    if (ids.length) {
                        window.open("./?m=order&a=vipprint&id=" + ids);
                    }
                });
                $("#daojs").click(function(){
                          var ids = new Array();
                    $(".order_id:checked").each(function(i) {
                        ids[i] = $(this).val();
                    });
                    if (ids.length) {
                        window.open("./?m=order&a=vipprint&type=2&id=" + ids);
                    }
                });
                
            });
        </script>
    </head>
    <body>
        <div class="ibox-content">
            <form class="form-horizontal">
                <input type="hidden" name="m" value="order">
                <input type="hidden" name="a" value="list">
                <div class="form-group">

                    <label class="col-sm-1 control-label" style="width: 100px;">客户简称：</label>

                    <div class="col-sm-2">
                        <select class="form-control m-b" id="custom_id" name="custom_id" style="padding-top:2px;">
                            <option value='0'>全部</option>
                            <?php foreach ($this->custom as $k => $v) { ?>
                                <option value='<?php echo $v['id'] ?>' <?php echo ($this->custom_id == $v['id']) ? 'selected' : '' ?> ><?php echo $v['nickname'] ?></option>                     
                            <?php } ?>
                        </select>
                    </div>
                    <label class="col-sm-1 control-label" style="width: 100px;">提单号：</label>

                    <div class="col-sm-2">
                        <input class="form-control m-b" name="lading_code" id="contact" value="<?php echo $this->lading_code; ?>" style="padding-top:2px;">
                    </div>
                    <label class="col-sm-1 control-label" style="width: 125px;">承运单号：</label>

                    <div class="col-sm-2">
                        <input class="form-control m-b" name="orderid_detail" id="contact" value="<?php echo $this->orderid_detail; ?>" style="padding-top:2px;">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label" style="width: 100px;">车队：</label>
                    <div class="col-sm-2">
                        <select class="form-control m-b"  name="team_id" style="padding-top:2px;">
                            <option value='0'>全部</option>
                            <?php foreach ($this->team as $k => $v) { ?>
                                <option value='<?php echo $v['id'] ?>' <?php echo ($this->team_id == $v['id']) ? 'selected' : '' ?> ><?php echo $v['name'] ?></option>                     
                            <?php } ?>
                        </select>
                    </div>
                    <label class="col-sm-1 control-label" style="width: 100px;">车牌：</label>

                    <div class="col-sm-2">
                        <select class="form-control m-b" name="car_id" style="padding-top:2px;">
                            <option value='0'>全部</option>
                            <?php foreach ($this->car as $k => $v) { ?>
                                <option value="<?php echo $v['id'] ?>" <?php echo($this->car_id == $v['id']) ? 'selected' : '' ?> ><?php echo $v['name'] ?></option>
                            <?php } ?>
                        </select>
                    </div>
                    <label class="col-sm-1 control-label" style="width: 125px;">箱号：</label>

                    <div class="col-sm-2">
                        <input class="form-control m-b" name="box_code" value="<?php echo $this->box_code; ?>" style="padding-top:2px;">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-1 control-label" style="width: 100px;">做箱时间:</label>
                    <div class="col-sm-4">
                        <div class="input-daterange input-group  m-b"  id="datepicker">
                            <input class="input-sm form-control" name="start" onfocus="WdatePicker({skin: 'whyGreen', dateFmt: 'yyyy-MM-dd'})" type="text" value="<?php echo $this->start; ?>">
                            <span class="input-group-addon">到</span>
                            <input class="input-sm form-control" name="end" onfocus="WdatePicker({skin: 'whyGreen', dateFmt: 'yyyy-MM-dd'})"  type="text" value="<?php echo $this->end; ?>">
                        </div>
                    </div>
                    <div class="col-sm-1">
                        <button class="btn btn-sm btn-info" type="submit">搜索</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="row">
            <div class="ibox float-e-margins" style="width:98%;margin-left:1%;">
                <div class="ibox-title" style="height:auto;">
                    <button class="btn btn-success " type="button" data-toggle="modal" id="new_order"><span class="bold">新增</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal"><span class="bold">进口批量新增</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal" id="delete"><span class="bold">删除</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal" id="zuofei" ><span class="bold">作废</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal"  id="fzuofei" ><span class="bold">反作废</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal" id="tosubmit"><span class="bold">提交</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal"><span class="bold">保存</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal"><span class="bold">修改</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal"><span class="bold">查看</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal"><span class="bold">预录数据校对</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal" id="daocyd"><span class="bold">导出承运单</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal" id="cyprint"><span class="bold">打印承运单</span></button>
                    <button class="btn btn-success " type="button"  id="daojs"><span class="bold">导出结算单</span></button>
                    <button class="btn btn-success " type="button"  id="vipprint"><span class="bold">结算表(票)</span></button>
                    <button class="btn btn-success " type="button"  id="hx"><span class="bold">货箱信息核对</span></button>
                    <button class="btn btn-success " type="button"  id="release"><span class="bold">海关电子放行</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal"><span class="bold">批量放箱</span></button>
                    <button class="btn btn-success " type="button" data-toggle="modal"><span class="bold">可重新放箱</span></button>
                    <div style="clear:both;"></div>
                </div>
                <div class="ibox-content">
                    <table class="table table-bordered">
                        <thead>
                            <tr>
                                <th>选择</th>
                                <th>序号</th>
                                <th>状态</th>
                                <th>承运单号</th>
                                <th>做箱时间</th>
                                <th>客户简称</th>
                                <th>门点</th>
                                <th>船名</th>
                                <th>船次</th>
                                <th>提单号</th>
                                <th>业务方式</th>
                                <th>内部编号</th>
                                <th>提箱点</th>
                                <th>还箱点</th>
                                <th>车牌</th>
                                <th>司机</th>
                                <th>司机手机</th>
                                <th>车队</th>
                                <th>箱号</th>
                                <th>封条号</th>
                                <th>交接单时间</th>
                                <th>皮重</th>
                                <th>最后修改人</th>
                                <th>最后修改时间</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $qq = 1;
                            foreach ($this->detail as $k => $v) {
                                ?>
                                <tr class="tbody">
                                    <td>
                                        <div class="checkbox i-checks up">
                                            <label>
                                                <input type="checkbox"  class="order_id"  value="<?php echo $v['id'] ?>" <i></i></label>
                                        </div>
                                    </td>     
                                    <td><?php echo $qq; ?></td>
                                    <td><?php echo ($v['status'] == 1) ? '可提交' : '作废' ?></td>
                                    <td><?php echo $v['orderid_detail'] ?></td>
                                    <td><?php echo $v['dobox_time'] ?></td>
                                    <td><?php echo $v['custom_id'] ?></td>
                                    <td><?php echo $v['custom_site_id'] ?></td>
                                    <td><?php echo $v['ship_name'] ?></td>
                                    <td><?php echo $v['ship_line'] ?></td>
                                    <td><?php echo $v['lading_code'] ?></td>
                                    <td><?php echo $this->service[$v['service_mode_id']] ?></td>
                                    <td><?php echo $v['inner_code'] ?></td>
                                    <td><?php echo $v['send_yard_id'] ?></td>
                                    <td><?php echo $v['back_yard_id'] ?></td>
                                    <td><?php echo $v['car_id'] ?></td>
                                    <td><?php echo $v['driver_id'] ?></td>
                                    <td><?php echo $v['driver_phone'] ?></td>
                                    <td><?php echo $v['car_team_id'] ?></td>
                                    <td><?php echo $v['box_code'] ?></td>
                                    <td><?php echo $v['seal_code'] ?></td>
                                    <td><?php echo $v['transfer_time'] ?></td>
                                    <td><?php echo $v['weight'] ?></td>
                                    <td><?php echo $v['update_user'] ?></td>
                                    <td><?php echo $v['update_time'] ?></td>
                                </tr>
                                <?php
                                $qq++;
                            }
                            ?>
                        </tbody>
                    </table>

                </div>
            </div>
        </div>


        <div class="outside_pull"></div>
        <script src="./src/js/plugins/iCheck/icheck.min.js"></script>
        <script>
                                $(document).ready(function() {
                                    $('.i-checks').iCheck({
                                        checkboxClass: 'icheckbox_square-green',
                                        radioClass: 'iradio_square-green',
                                    });
                                });
                                $(function() {
                                    $(".iCheck-helper").click(function() {
                                        ind = $(".iCheck-helper").index($(this));
                                        $(".up").eq(ind).click();
                                    });
                                });
        </script>
    </body>
</html>
